
package ch.hearc.coursJava.kitBase.tools;

import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import java.util.Random;

public class ContainerTools
	{

	/*------------------------------------------------------------------*\
	|*							Methodes Public							*|
	\*------------------------------------------------------------------*/

	public static List<Double> toList(double[] tabX)
		{
		List<Double> listeX = new ArrayList<Double>(tabX.length);

		for(double x:tabX)
			{
			listeX.add(x);
			}

		return listeX;
		}

	public static boolean isEgal(List<Integer> liste1, List<Integer> liste2)
		{
		if (liste1.size() != liste2.size())
			{
			return false;
			}
		else
			{
			ListIterator<Integer> it1 = liste1.listIterator();
			ListIterator<Integer> it2 = liste2.listIterator();

			while(it1.hasNext())
				{
				Integer elem1 = it1.next();
				Integer elem2 = it2.next();
				if (elem1 != elem2) { return false; }

				}
			return true;
			}
		}

	public static int tireUnNombre(int min, int max)
		{
		int nb;

		Random r = new Random();
		nb = min + r.nextInt(max + 1 - min);

		return nb;
		}
	/*------------------------------------------------------------------*\
	|*							Methodes Private						*|
	\*------------------------------------------------------------------*/

	}
